﻿using Anke.SHManage.Model;
using Anke.SHManage.MSSQLDAL;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Anke.SHManage.BLL
{
    public partial class I_InvoiceApprovalBLL
    {
        private I_InvoiceApprovalDALExt dal = new I_InvoiceApprovalDALExt();

        //public object GetInvoiceApplyList(int page, int rows, string sortName, string sortOrder, ref int rowCounts, string centerID, DateTime beginTime, DateTime endTime)
        //{
        //    return dal.GetInvoiceApplyList(page, rows, sortName, sortOrder, ref rowCounts, centerID, beginTime, endTime);
        //}
        public object GetInvoiceApplyList(int page, int rows, string sortName, string sortOrder, ref int rowCounts, string centerID, DateTime beginTime, DateTime endTime, string stationID, string personName)
        {
            return dal.GetInvoiceApplyList(page, rows, sortName, sortOrder, ref rowCounts, centerID, beginTime, endTime, stationID, personName);
        }

        public bool IFExistInvoice(string txtStartNumber, string txtEndNumber)
        {

            return dal.IFExistInvoice(txtStartNumber, txtEndNumber);
        }

        public int AddI_InvoiceApprovalList(Int64 applyCount, Int64 startNumber, string ApplyID)
       {
           try {
               return dal.AddI_InvoiceApprovalList(applyCount, startNumber, ApplyID);
           }
             catch (Exception ex)
            {
                return -1;
            }
            
       }

        public int deleteI_InvoiceApproval(string ApplyID)
        {
            try
            {
                return dal.deleteI_InvoiceApproval( ApplyID);
            }
            catch (Exception ex)
            {
                return -1;
            }
            
        }

        //获取手动销号的列表
        public object getINClearList(int page, int rows, string sortName, string sortOrder, ref int rowCounts, string centerID, DateTime beginTime, DateTime endTime)
        {
            return dal.GetINClearList(page, rows, sortName, sortOrder, ref rowCounts, centerID, beginTime, endTime);
        }

        //2018-12-11 zch
        public void DealUsedInvoiceRecord(string invoiceNumber)
        {
            try
            {
                dal.UpdateInvoiceState(invoiceNumber);
            }
            catch (Exception ex)
            {
                Utility.LogUtility.Error("I_InvoiceApprovalBLL.DealUsedInvoiceRecord(); invoiceNumber:" + invoiceNumber, ex.Message);
            }
        }
       
    }
}
